MIDIBendWindow

part of wslib

a graphic interface for midi pitchbend data.

also see: MIDIWindow

MIDIBendWindow();

The MIDIBendWindow is a global window; there can be only one at a time.

It connects 16 channels of pitchbend information sliders, Busses and actions. The sliders can also be moved by hand, which will have the same result; if you don't have your MIDI controller at hand this option might prove very useful. The sliders on MIDIBendWindow are SmoothSliders.

The MIDIBendWindow is built for interaction with MIDI controllers such as the Peavey PC1600x. If you select the "16xPitchbend" preset on that machine, you immedeately are connected to the MIDIBendWindow.

The MIDIBendWindow can also record and playback movements, and plot, read and write them to MIDI files using SimpleMIDIFile.

similar undocumented classes:

MIDITouchWindow

MIDIControlWindow

MIDICinetixWindow

MIDIBendWindow ( nC , busOffset, initValues, historySize, maxMIDIVal, inAction, left, bottom, height )

nC : number of channels (default 16)

busOffset : bus number to connect the first slider to. The other will be connected to the subsequent ones.

initValues : the initial values of the sliders (default [ ] )

historySize : every slider keeps an array with previous values. It's size should be at least 1 (default)

maxMIDIVal : value at which the slider will be fully open.

inAction : an action which is added to all sliders. it's passed arguments are:

sliderNumber, sliderValue, lastSliderValue ... earlierSliderValues (depending on historySize)

left, bottom, height : the bounds of the window. The width is derrived from nC

MIDIBendWindow.addFaderAction ( n, action )

n : the number of the slider to add the action to

action : a function to be evaluated every time the slider is moved (or a MIDI pitchbend event for that channel is received). The arguments passed to it are:

sliderNumber, sliderValue, lastSliderValue ... earlierSliderValues (depending on historySize)

if an action for slider n already existed it is replaced by the new one.

(

MIDIBendWindow.addFaderAction( 0, { |i, val, lastval|

"fader % moved from % to %\n".postf( i + 1, lastval, val ) } );

)

MIDIBendWindow.addTreshAction ( n, val, up, down )

n : the number of the slider to add the action to

val : if the slider passes this value, one of the actions will be evaluated

up : a function to be evaluated every time the slider is moved upwards past the val

down : a function to be evaluated every time the slider is moved downwards past the val

The arguments passed to the up and down functions are:

sliderNumber, sliderValue, lastSliderValue ... earlierSliderValues (depending on historySize)

if a treshAction for slider n at value val already existed it is replaced by the new one.

(

MIDIBendWindow.addTreshAction( 1, 0.5,

{ |i, val, lastval| "fader % moved up and passed 0.5\n".postf( i+1) },

{ |i, val, lastval| "fader % moved down and passed 0.5\n".postf( i+1) } );

)